package com.siwei.mes.service.experiment.impl;

import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.siwei.mes.common.util.*;
import com.siwei.mes.config.CompanyConfigInterceptor;
import com.siwei.mes.entity.ShxhSynchronizedata;
import com.siwei.mes.entity.dto.*;
import com.siwei.mes.entity.erp.*;
import com.siwei.mes.entity.experiment.*;
import com.siwei.mes.entity.experiment.concrete.batch.ConcreteKyqd;
import com.siwei.mes.entity.experiment.concrete.batch.ConcreteKzqd;
import com.siwei.mes.entity.experiment.concrete.batch.ConcreteXnbgLlzhl;
import com.siwei.mes.entity.experiment.concrete.quick.ConcreteBsx;
import com.siwei.mes.entity.experiment.concrete.quick.ConcreteMctld;
import com.siwei.mes.entity.experiment.concrete.quick.ConcreteZjx;
import com.siwei.mes.entity.mixproportion.MixProportion;
import com.siwei.mes.entity.mixproportion.MixProportionReport;
import com.siwei.mes.entity.mixproportion.MixProportionVerifyRecord;
import com.siwei.mes.entity.sync.erp.ErpProject;
import com.siwei.mes.entity.sync.tc.SupplyTask;
import com.siwei.mes.entity.system.CompanyConfig;
import com.siwei.mes.entity.system.Equipment;
import com.siwei.mes.entity.system.Signature;
import com.siwei.mes.entity.system.SystemParam;
import com.siwei.mes.entity.vo.ExperimentPrintVo;
import com.siwei.mes.enums.*;
import com.siwei.mes.mapper.ShxhSynchronizedataMapper;
import com.siwei.mes.mapper.erp.ItemorderMapper;
import com.siwei.mes.mapper.erp.RwdextraExtendMapper;
import com.siwei.mes.mapper.erp.RwdextraUpdateLogMapper;
import com.siwei.mes.mapper.experiment.*;
import com.siwei.mes.mapper.mixProportion.MixProportionMapper;
import com.siwei.mes.mapper.mixProportion.MixProportionVerifyRecordMapper;
import com.siwei.mes.mapper.syncErp.ErpProjectMapper;
import com.siwei.mes.mapper.system.SystemParamMapper;
import com.siwei.mes.service.erp.PhbhistoryService;
import com.siwei.mes.service.erp.RwdextraService;
import com.siwei.mes.service.experiment.ExperimentTaskService;
import com.siwei.mes.service.experiment.PrintService;
import com.siwei.mes.service.system.EquipmentService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.*;

/**
 * 打印相关
 *
 * @Description: 打印相关
 * @Version: 1.0
 * @author: mlchen
 * @date: 2024/7/24 10:56
 */
@Slf4j
@Service
public class PrintServiceImpl implements PrintService {
    @Resource
    private ExperimentMapper experimentMapper;
    @Resource
    private ExperimentDetailMapper experimentDetailMapper;
    @Resource
    private ExperimentSampleSmokeMapper experimentSampleSmokeMapper;
    @Resource
    private ExperimentSampleTakeMapper experimentSampleTakeMapper;
    @Resource
    private ExperimentTaskService experimentTaskService;
    @Resource
    private ExperimentSupplyTaskMapper experimentSupplyTaskMapper;
    @Resource
    private ShxhSynchronizedataMapper shxhSynchronizedataMapper;
    @Resource
    private RwdextraService rwdextraService;
    @Resource
    private PhbhistoryService phbhistoryService;
    @Resource
    private RwdextraUpdateLogMapper rwdextraUpdateLogMapper;
    @Resource
    private EquipmentService equipmentService;
    @Resource
    private MixProportionMapper mixProportionMapper;
    @Resource
    private OpenAppraisalMapper openAppraisalMapper;
    @Resource
    private MixProportionVerifyRecordMapper mixProportionVerifyRecordMapper;
    @Resource
    private ErpProjectMapper erpProjectMapper;
    @Resource
    private ItemorderMapper itemorderMapper;
    @Resource
    private RwdextraExtendMapper rwdextraExtendMapper;
    @Resource
    private SystemParamMapper systemParamMapper;
    @Resource
    private ExperimentSignatureMapper experimentSignatureMapper;


    @Override
    public List<PrintExperimentInfo> getExperimentPrintInfo(List<Long> experimentIdList) {
        List<PrintExperimentInfo> list = new ArrayList<>();
        for (Long experimentId : experimentIdList) {
            PrintExperimentInfo printInfo = new PrintExperimentInfo();
            /**试验台账信息*/
            Experiment experiment = experimentMapper.loadById(experimentId);
            if (experiment == null) {
                log.info("获取打印数据，对应的试验台账信息不存在，试验台账id：【{}】", experimentId);
                continue;
            }
            /**企业配置信息*/
            CompanyConfig companyConfig = CompanyConfigInterceptor.getCompanyConfig(1);
            printInfo.setCompanyInfo(companyConfig);
            printInfo.setCompanyName(companyConfig.getCompanyName());
            printInfo.setExperimentId(experimentId);
            printInfo.setExperimentType(experiment.getExperimentType());
            printInfo.setExperimentInfo(experiment);
            /**试验台账对应试验项目信息*/
            List<ExperimentDetail> experimentDetailList = experimentDetailMapper.selectByExperimentId(experimentId, null);
            printInfo.setExperimentDetailList(experimentDetailList);
            /**试验台账抽样信息*/
            List<ExperimentSampleSmoke> experimentSampleSmokeList = experimentSampleSmokeMapper.selectByExperimentId(experimentId);
            printInfo.setExperimentSampleSmokeList(experimentSampleSmokeList);
            /**取样信息*/
            ExperimentSampleTake experimentSampleTake = experimentSampleTakeMapper.selectByExperimentId(experimentId);
            printInfo.setExperimentSampleTakeInfo(experimentSampleTake);

            /**上海协会相关数据*/
            List<ShxhSynchronizedata> shxhSynchronizedataList = shxhSynchronizedataMapper.selectByExperimentId(experimentId);
            printInfo.setShxhSynchronizedataList(shxhSynchronizedataList);

            Integer experimentType = experiment.getExperimentType();
            /**如果是混凝土 对应的任务信息是ERP的*/
            if (MaterialsEnum.CONCRETE.getCode().equals(experimentType)) {
                List<Rwdextra> rwdextraList = experimentTaskService.selectByExperimentId(experimentId);
                printInfo.setRwdextraList(rwdextraList);

                if (!rwdextraList.isEmpty()) {
                    /**查询任务单对应的配合比信息  这里查询的是更换配合比的历史记录的最后一条*/
                    RwdextraUpdateLog updateLogInfo = rwdextraUpdateLogMapper.selectByLastUpdateInfo(rwdextraList.get(0).getFrwdh());
                    if (updateLogInfo != null) {
                        JSONObject afterJson = updateLogInfo.getMixUpdateAfterJson();
                        if (afterJson != null) {
                            printInfo.setMixProportion(JsonUtils.getObject(afterJson, MixProportion.class));
                        }
                    }
                }
            } else {
                PrintTaskExperimentInfo printTaskExperimentInfo = this.getPrintTaskExperimentInfo(experimentId);
                PrintMixExperimentInfo printMixExperimentInfo = new PrintMixExperimentInfo();
                if (MaterialsEnum.CEMENT.getCode().equals(experimentType)) {
                    printMixExperimentInfo.setSnInfo(printTaskExperimentInfo);
                } else if (MaterialsEnum.FLY.getCode().equals(experimentType)) {
                    printMixExperimentInfo.setFmhInfo(printTaskExperimentInfo);
                } else if (MaterialsEnum.SLAG.getCode().equals(experimentType)) {
                    printMixExperimentInfo.setKzfInfo(printTaskExperimentInfo);
                } else if (MaterialsEnum.COARSE.getCode().equals(experimentType)) {
                    printMixExperimentInfo.setCglInfo(printTaskExperimentInfo);
                } else if (MaterialsEnum.FINE.getCode().equals(experimentType)) {
                    printMixExperimentInfo.setXglInfo(printTaskExperimentInfo);
                } else if (MaterialsEnum.ADMIXTURE.getCode().equals(experimentType)) {
                    printMixExperimentInfo.setWjj1Info(printTaskExperimentInfo);
                }
                printInfo.setMixExperimentInfo(printMixExperimentInfo);
                ExperimentSignature experimentSignature = experimentSignatureMapper.loadByExperimentId(experimentId);
                if(experimentSignature != null){
                    printInfo.setSignature(JsonUtils.getObject(experimentSignature.getSignatureJson(), Signature.class));
                }
                /**其它的任务信息是砼材的*/
                List<SupplyTask> supplyTasks = experimentSupplyTaskMapper.selectByExperimentId(experimentId);
                printInfo.setSupplyTaskList(supplyTasks);
            }
            list.add(printInfo);
        }
        return list;
    }

    @Override
    public List<PrintExperimentInfo> getErpRwdPrintInfo(List<Integer> frwdIdList) {
        List<PrintExperimentInfo> list = new ArrayList<>();
        /**所有铁标工程名称*/
        List<String> isIronMarkProjectName = erpProjectMapper.getIsIronMarkProjectName();
        try {
            for (Integer frwd : frwdIdList) {
                Rwdextra rwdextra = rwdextraService.selectByFrwdh(frwd);
                if (rwdextra == null) {
                    log.info("获取打印数据，对应的ERP任务单信息不存在，任务单id：【{}】", frwd);
                    continue;
                }
                RwdextraExtend rwdextraExtend = rwdextra.getRwdextraExtend();
                /**组装打印的printJson*/
                PrintExperimentInfo printInfo = this.payloadPrintExperimentInfo(rwdextra, rwdextraExtend);

                /**判断是否是铁标工程*/
                if (isIronMarkProjectName.contains(rwdextra.getRwdextraInfo().getFGcmc())) {
                    List<Rwdextra> rwdextraList = printInfo.getRwdextraList();
                    for (Rwdextra rwdextraInfo : rwdextraList) {
                        RwdextraExtend rwdextraExtendInfo = rwdextraInfo.getRwdextraExtend();
                        if (rwdextraExtendInfo == null) {
                            continue;
                        }
                        JSONObject materialsInfoJson = rwdextraExtendInfo.getMaterialsInfoJson();
                        if (materialsInfoJson == null || materialsInfoJson.isEmpty()) {
                            continue;
                        }
                        if (rwdextraExtendInfo.getPrintJson() == null) {
                            continue;
                        }
                        MixProportion mixProportion = printInfo.getMixProportion();
                        if (mixProportion == null || mixProportion.getProportionMaterial() == null) {
                            continue;
                        }
                        RwdextraExtendMaterials extendMaterials = JsonUtils.getObject(materialsInfoJson, RwdextraExtendMaterials.class);
                        MixProportionReport mixProportionReport = JsonUtils.getObject(mixProportion.getProportionMaterial(), MixProportionReport.class);
                        /** 出厂质量证明书 和 配合比设计报告把对应的值覆盖掉 */
                        setRwdextraExtendMaterials(extendMaterials,mixProportionReport);
                        mixProportion.setProportionMaterial(JsonUtils.beanToObject(mixProportionReport));
                        printInfo.setMixProportion(mixProportion);
                        /** 开盘鉴定 把对应的值覆盖掉 */
                        OpenAppraisal openAppraisal = printInfo.getOpenAppraisal();
                        if(openAppraisal == null){
                            continue;
                        }
                        MixProportionReport mixProportionReportOpen = JsonUtils.getObject(openAppraisal.getRwdextraPrintInfo().getMixProportionInfo().getProportionMaterial(), MixProportionReport.class);
                        setRwdextraExtendMaterials(extendMaterials,mixProportionReportOpen);
                        openAppraisal.getRwdextraPrintInfo().getMixProportionInfo().setProportionMaterial(JsonUtils.beanToObject(mixProportionReportOpen));
                    }
                }
                list.add(printInfo);
            }
        } catch (Exception e) {
            log.error("任务单打印报错，错误信息：{}", e.getMessage(), e);
        }
        return list;
    }

    /**
     * 组装打印的printJson
     *
     * @param rwdextra       任务单信息
     * @param rwdextraExtend 任务单扩展信息
     */
    private PrintExperimentInfo payloadPrintExperimentInfo(Rwdextra rwdextra, RwdextraExtend rwdextraExtend) {
        Integer frwd = rwdextra.getFrwdh();
        log.info("开始组装任务单打印json数据，任务单号：【{}】", frwd);
        PrintExperimentInfo printInfo = new PrintExperimentInfo();

        /**企业配置信息*/
        CompanyConfig companyConfig = CompanyConfigInterceptor.getCompanyConfig(1);
        SystemParam systemParamXgl = systemParamMapper.selectBySystemCode(SystemParamEnum.IS_SHOW_SS_LLZ);
        if(systemParamXgl != null){
            companyConfig.setXglLlz(systemParamXgl.getSystemValue());
        }
        SystemParam systemParamHnt = systemParamMapper.selectBySystemCode(SystemParamEnum.IS_SHOW_HNT_LLZ);
        if(systemParamHnt != null){
            companyConfig.setHntLlz(systemParamHnt.getSystemValue());
        }
        printInfo.setCompanyInfo(companyConfig);
        printInfo.setCompanyName(companyConfig.getCompanyName());
        printInfo.setFrwdh(frwd);

        JSONObject printJson = rwdextraExtend.getPrintJson();

        if (printJson != null) {
            RwdextraPrintInfo rwdextraPrintInfo = JsonUtils.getObject(printJson, RwdextraPrintInfo.class);
            if (rwdextraPrintInfo == null) {
                return printInfo;
            }
            setRwdextraPrintInfo(rwdextraPrintInfo, printInfo,rwdextra.getRwdextraInfo().getKsdj());
            rwdextraExtend.setRwdextraPrintInfo(rwdextraPrintInfo);
            rwdextraExtend.setPrintJson(printJson);
            /** 如果创建时间没值，查询一次 **/
            if (rwdextraExtend.getCreateTime() == null) {
                RwdextraExtend extendInfo = rwdextraExtendMapper.selectByFRwdh(frwd);
                rwdextraExtend.setCreateTime(extendInfo.getCreateTime());
            }
            rwdextra.setRwdextraExtend(rwdextraExtend);
            printInfo.setRwdextraList(Collections.singletonList(rwdextra));
            MixProportion mixProportion = rwdextraPrintInfo.getMixProportionInfo();
            if (mixProportion == null) {
                return printInfo;
            }
            printInfo.setMixProportion(mixProportion);
            /**任务单的配比，去拿到对应材料类型，材料名称，材料规格，去获取最近已完成的一份试验*/
            PrintMixExperimentInfo mixMaterialsExperimentInfo = this.getMixExperimentInfoUpdatePhb(mixProportion);
            printInfo.setMixExperimentInfo(mixMaterialsExperimentInfo);
            printInfo.setMixMaterialsExperimentInfo(mixMaterialsExperimentInfo);
            /**根据ERP任务单查询ERP的配合比修改记录*/
            List<Phbhistory> phbhistoryList;
            if (rwdextraPrintInfo.getPhbhistoryList() == null) {
                phbhistoryList = phbhistoryService.selectByRwdhAndPhb(frwd, mixProportion);
            } else {
                phbhistoryList = rwdextraPrintInfo.getPhbhistoryList();
            }
            printInfo.setPhbhistoryList(phbhistoryList);
            /**根据ERP任务单查询开盘鉴定信息*/
            if (rwdextraExtend.getOpenAppraisalId() != null) {
                OpenAppraisal openAppraisal = openAppraisalMapper.loadById(rwdextraExtend.getOpenAppraisalId());
                if (openAppraisal != null) {
                    rwdextra.setAppraisalDate(itemorderMapper.selectByFrwdhCreateTime(openAppraisal.getFrwdh()));
                    RwdextraPrintInfo openAppraisalRwdextraPrintInfo = JsonUtils.getObject(openAppraisal.getPrintJson(), RwdextraPrintInfo.class);
                    if (openAppraisalRwdextraPrintInfo != null) {
                        Rwdextra openAppraisalRwdextra = rwdextraService.selectByFrwdh(openAppraisal.getFrwdh());
                        MixProportion openAppraisalProportion = openAppraisalRwdextraPrintInfo.getMixProportionInfo();
                        /**先把调整记录赋值，计划日期后面要重新覆盖新的值**/
                        openAppraisal.setPhbhistory(phbhistoryService.selectByRwdhAndTime(openAppraisal.getFrwdh(), openAppraisalProportion, 1));
                        setOpenAppraisalRwdextraPrintInfo(openAppraisalRwdextraPrintInfo, openAppraisalRwdextra);
                        openAppraisalRwdextraPrintInfo.setRwdextra(openAppraisalRwdextra);
                        openAppraisal.setRwdextraPrintInfo(openAppraisalRwdextraPrintInfo);
                    }
                    /** 开盘鉴定编号 **/
                    if (StringUtils.isNotBlank(rwdextraExtend.getRwdextraPrintInfo().getKpjdbh())) {
                        openAppraisal.setLedgerNo(rwdextraExtend.getRwdextraPrintInfo().getKpjdbh());
                    }
                }
                printInfo.setOpenAppraisal(openAppraisal);
            }
            printInfo.setPhbhistory(phbhistoryService.selectByRwdhAndTime(frwd, mixProportion, 0));
            /**根据ERP任务单查询ERP的配合比修改记录 (第一次小票)*/
            if (rwdextraPrintInfo.getPhbhistory() != null) {
                printInfo.setPhbhistory(rwdextraPrintInfo.getPhbhistory());
            }
            printInfo.setSignature(rwdextraPrintInfo.getSignature());
        }
        return printInfo;
    }

    /**
     * 根据任务单查询混凝土台账对应信息
     *
     * @param rwdextraPrintInfo 任务单打印json
     * @return
     */
    private void setRwdextraPrintInfo(RwdextraPrintInfo rwdextraPrintInfo, PrintExperimentInfo printInfo, String ksdj) {
        if (rwdextraPrintInfo == null || printInfo == null) {
            return;
        }
        Map<String, List<ExperimentSimpleDto>> kyMapInfo = new HashMap();
        List<PrintTaskExperimentInfo> kyList = new ArrayList();
        List<RwdextraPrintInfo.Kytz> kyInfoList = rwdextraPrintInfo.getKyInfoList();
        List<Long> kyExperimentIdList = new ArrayList();
        if (CollectionUtil.isNotEmpty(kyInfoList)) {
            for (RwdextraPrintInfo.Kytz kytz : kyInfoList) {
                PrintTaskExperimentInfo kyInfo = this.getPrintTaskExperimentInfo(kytz.getSytzbh());
                if (kyInfo != null) {
                    JSONObject objJson = new JSONObject();
                    kytz.setYpbh(kyInfo.getExperimentInfo().getSampleId());
                    List<ExperimentDetail> experimentDetailList = kyInfo.getExperimentDetailList();
                    for (ExperimentDetail experimentDetail : experimentDetailList) {
                        /**抗压试验**/
                        if (experimentDetail.getTestProjectCode().equals(TestProjectEnum.CONCRETE_PARAM_KYQD.getCode())) {
                            ConcreteKyqd concreteKyqd = experimentDetail.getObjJson().toJavaObject(ConcreteKyqd.class);
                            kytz.setQdpjz(concreteKyqd.getPjz28d());
                            kytz.setDdsjqd(concreteKyqd.getFyxs28d());
                            kytz.setZsbzqd(concreteKyqd.getZsbzqd28d());
                            objJson = experimentDetail.getObjJson();
                        }
                    }
                    kyList.add(kyInfo);
                    String reportNo = StringUtils.isNotBlank(kyInfo.getExperimentInfo().getReportNo()) ? kyInfo.getExperimentInfo().getReportNo() : "isNull";
                    if (StringUtils.isNotBlank(reportNo)) {
                        List<ExperimentSimpleDto> experimentSimpleDtoList;
                        ExperimentSimpleDto experimentSimpleDto = new ExperimentSimpleDto();
                        experimentSimpleDto.setReportDate(kyInfo.getExperimentInfo().getReportDate());
                        experimentSimpleDto.setExperimentGist(kyInfo.getExperimentInfo().getExperimentGist());
                        experimentSimpleDto.setJudgeGist(kyInfo.getExperimentInfo().getJudgeGist());
                        experimentSimpleDto.setMaterialsSpecs(kyInfo.getExperimentInfo().getMaterialsSpecs());
                        experimentSimpleDto.setSampleID(kyInfo.getExperimentInfo().getSampleId());
                        experimentSimpleDto.setMoldingDate(kyInfo.getExperimentInfo().getMoldingTime());
                        experimentSimpleDto.setBehalfNumber(kyInfo.getExperimentInfo().getBehalfNumber());
                        experimentSimpleDto.setRemark(kyInfo.getExperimentInfo().getRemark());
                        experimentSimpleDto.setObjJson(objJson);
                        if (kyMapInfo.containsKey(reportNo)) {
                            experimentSimpleDtoList = kyMapInfo.get(reportNo);
                        } else {
                            experimentSimpleDtoList = new ArrayList();
                        }
                        experimentSimpleDtoList.add(experimentSimpleDto);
                        kyMapInfo.put(reportNo, experimentSimpleDtoList);
                    }
                    kyExperimentIdList.add(kyInfo.getExperimentInfo().getId());
                }
            }
        }
        printInfo.setKyMapInfo(kyMapInfo);
        /**抗渗台账*/
        Long ksExperimentId = rwdextraPrintInfo.getKsExperimentId();
        if (ksExperimentId != null) {
            PrintTaskExperimentInfo ksInfo = this.getPrintTaskExperimentInfo(ksExperimentId);
            printInfo.setKsInfo(ksInfo);
            if (ksInfo != null) {
                Experiment experiment = ksInfo.getExperimentInfo();
                rwdextraPrintInfo.setKstzypbh(experiment.getSampleId());
                rwdextraPrintInfo.setKstzwtbh(experiment.getConsignId());
                rwdextraPrintInfo.setKstzjl(NullUtils.isQualified(experiment.getIsQualified()));
                /*List<ExperimentDetail> experimentDetailList = ksInfo.getExperimentDetailList();
                if (CollectionUtil.isNotEmpty(experimentDetailList)) {
                    for (ExperimentDetail experimentDetail : experimentDetailList) {
                        if (experimentDetail.getTestProjectCode().equals(TestProjectEnum.CONCRETE_PARAM_KSDJ.getCode())) {
                            *//**将json转成对象*//*
                            ConcreteKsdj concreteKsdj = experimentDetail.getObjJson().toJavaObject(ConcreteKsdj.class);
                            String ssksdj = concreteKsdj.getSsksdj();
                            String ksdj = ksInfo.getExperimentInfo().getKsdj();
                            if (StringUtils.isNotBlank(ksdj)) {
                                if (ssksdj.compareTo(ksdj) >= 0) {
                                    rwdextraPrintInfo.setKstzjl("合格");
                                } else {
                                    rwdextraPrintInfo.setKstzjl("不合格");
                                }
                            } else {
                                rwdextraPrintInfo.setKstzjl("合格");
                            }
                        }
                    }
                }*/
            }
        }
        /**抗折台账*/
        Long kzExperimentId = rwdextraPrintInfo.getKzExperimentId();
        if (kzExperimentId != null) {
            PrintTaskExperimentInfo kzInfo = this.getPrintTaskExperimentInfo(kzExperimentId);
            printInfo.setKzInfo(kzInfo);
            if (kzInfo != null) {
                rwdextraPrintInfo.setKztzypbh(kzInfo.getExperimentInfo().getSampleId());
                rwdextraPrintInfo.setKztzwtbh(kzInfo.getExperimentInfo().getExperimentNo());
                List<ExperimentDetail> experimentDetailList = kzInfo.getExperimentDetailList();
                if (CollectionUtil.isNotEmpty(experimentDetailList)) {
                    for (ExperimentDetail experimentDetail : experimentDetailList) {
                        if (experimentDetail.getTestProjectCode().equals(TestProjectEnum.CONCRETE_PARAM_KZQD.getCode())) {
                            /**将json转成对象*/
                            ConcreteKzqd concreteKzqd = experimentDetail.getObjJson().toJavaObject(ConcreteKzqd.class);
                            rwdextraPrintInfo.setKztzjl(concreteKzqd.getDxjl());
                        }
                    }
                }
            }
        }
        rwdextraPrintInfo.setKyInfoList(kyInfoList);
        printInfo.setKyInfoList(kyList);
        /**抗氯离子台账*/
        /**抗折台账*/
        Long kllExperimentId = rwdextraPrintInfo.getKllExperimentId();
        if (kllExperimentId != null) {
            PrintTaskExperimentInfo kllzInfo = this.getPrintTaskExperimentInfo(kllExperimentId);
            printInfo.setKllzInfo(kllzInfo);
        }
        /** 出厂证明签发日期 赋值  **/
        if (StringUtils.isBlank(rwdextraPrintInfo.getCczmqfrq())) {
            /** 如果有抗渗 任务单最后一车实际生产日期+配合比龄期加 （P6）,4(P8),5(P10),6(P12)  **/
            Date itemorderDate = itemorderMapper.selectByFrwdhCreateTimeMax(printInfo.getFrwdh());
            if (StringUtils.isNotBlank(rwdextraPrintInfo.getKsdj())) {
                ksdj = rwdextraPrintInfo.getKsdj();
            }
            if (itemorderDate != null) {
                MixProportion mixProportion = rwdextraPrintInfo.getMixProportionInfo();
                int dateNum;
                int lq = Integer.parseInt(mixProportion.getProportionLq());
                if (rwdextraPrintInfo.getKsExperimentId() != null && StringUtils.isNotBlank(ksdj)) {
                    dateNum = lq + KsLqEnum.selectByName(ksdj).getLq();
                } else {
                    dateNum = lq;
                }
                rwdextraPrintInfo.setCczmqfrq(DateHelper.addDateTime(itemorderDate, Calendar.DATE, dateNum, "yyyy-MM-dd"));
            } else {
                /** 如果任务单未生产,置空 **/
                rwdextraPrintInfo.setCczmqfrq("");
            }
//            /** 如果有抗渗 取抗渗报告日期 +1天  **/
//            Experiment experiment = experimentMapper.loadById(rwdextraPrintInfo.getKsExperimentId());
//            if(experiment != null && experiment.getReportDate() != null){
//                rwdextraPrintInfo.setCczmqfrq(DateHelper.addDateTime(experiment.getReportDate(),Calendar.HOUR,24,"yyyy-MM-dd"));
//            }else {
//                rwdextraPrintInfo.setCczmqfrq("");
//            }
//            if(CollectionUtil.isNotEmpty(kyExperimentIdList)){
//                /** 如果抗渗没有 取抗压报告 报告日期最大一条 报告日期+1天  **/
//                Date reportDate = experimentMapper.getMaxExperimentReportDate(kyExperimentIdList);
//                if(reportDate != null){
//                    rwdextraPrintInfo.setCczmqfrq(DateHelper.addDateTime(reportDate,Calendar.HOUR,24,"yyyy-MM-dd"));
//                }
//            }
        }
    }

    /**
     * 根据开盘鉴定信息中混凝土台账Id查询最新的台账实验结果
     *
     * @param rwdextraPrintInfo 开盘鉴定打印json
     * @return
     */
    private void setOpenAppraisalRwdextraPrintInfo(RwdextraPrintInfo rwdextraPrintInfo, Rwdextra rwdextra) {
        if (rwdextraPrintInfo != null) {
            /**抗压台账*/
            List<RwdextraPrintInfo.Kytz> kyInfoListOld = rwdextraPrintInfo.getKyInfoList();
            if (CollectionUtil.isNotEmpty(kyInfoListOld)) {
                List<RwdextraPrintInfo.Kytz> kyInfoList = new ArrayList<>();
                RwdextraPrintInfo.Kytz kyInfo = kyInfoListOld.get(0);
                if (StringUtils.isNotBlank(kyInfo.getSytzbh())) {
                    Long kyExperimentId = Long.valueOf(kyInfo.getSytzbh());
                    Experiment experiment = experimentMapper.loadById(kyExperimentId);
                    if (experiment != null) {
                        RwdextraPrintInfo.Kytz kytz = new RwdextraPrintInfo.Kytz();
                        kytz.setXhwtbh(experiment.getConsignId());
                        kytz.setYpbh(experiment.getSampleId());
                        kytz.setSytzbh(String.valueOf(experiment.getId()));
                        if (experiment.getReportDate() != null) {
                            rwdextra.setPlantime(experiment.getReportDate());
                        }
                        /**试验台账对应试验项目信息*/
                        List<ExperimentDetail> experimentDetailList = experimentDetailMapper.getList(new ExperimentDetail().setExperimentId(kyExperimentId));
                        for (ExperimentDetail experimentDetail : experimentDetailList) {
                            /**抗压试验**/
                            if (experimentDetail.getTestProjectCode().equals(TestProjectEnum.CONCRETE_PARAM_KYQD.getCode())) {
                                ConcreteKyqd concreteKyqd = experimentDetail.getObjJson().toJavaObject(ConcreteKyqd.class);
                                kytz.setQdpjz(concreteKyqd.getPjz28d());
                                kytz.setDdsjqd(concreteKyqd.getFyxs28d());
                                kytz.setZsbzqd(concreteKyqd.getZsbzqd28d());
                            }
                            /**塌落度试验**/
                            if (experimentDetail.getTestProjectCode().equals(TestProjectEnum.CONCRETE_PARAM_MCTLD.getCode())) {
                                /**将json转成对象*/
                                ConcreteMctld concreteMctld = experimentDetail.getObjJson().toJavaObject(ConcreteMctld.class);
                                rwdextraPrintInfo.setSctld(NullUtils.ifNull(concreteMctld.getTld1()));
                            }
                            /**粘聚性试验**/
                            if (experimentDetail.getTestProjectCode().equals(TestProjectEnum.CONCRETE_PARAM_ZJX.getCode())) {
                                /**将json转成对象*/
                                ConcreteZjx concreteZjx = experimentDetail.getObjJson().toJavaObject(ConcreteZjx.class);
                                if ("1".equals(concreteZjx.getFcc())) {
                                    rwdextraPrintInfo.setSczjx("非常差");
                                } else if ("1".equals(concreteZjx.getYb())) {
                                    rwdextraPrintInfo.setSczjx("一般");
                                } else if ("1".equals(concreteZjx.getHh())) {
                                    rwdextraPrintInfo.setSczjx("良好");
                                }
                            }
                            /**保水性试验**/
                            if (experimentDetail.getTestProjectCode().equals(TestProjectEnum.CONCRETE_PARAM_BSX.getCode())) {
                                ConcreteBsx concreteBsx = experimentDetail.getObjJson().toJavaObject(ConcreteBsx.class);
                                if ("1".equals(concreteBsx.getFcc())) {
                                    rwdextraPrintInfo.setScbsx("非常差");
                                } else if ("1".equals(concreteBsx.getYb())) {
                                    rwdextraPrintInfo.setScbsx("一般");
                                } else if ("1".equals(concreteBsx.getHh())) {
                                    rwdextraPrintInfo.setScbsx("良好");
                                }
                            }
                        }
                        kyInfoList.add(kytz);
                        rwdextraPrintInfo.setKyInfoList(kyInfoList);
                    }
                }
            }
            /**抗渗台账*/
            Long ksExperimentId = rwdextraPrintInfo.getKsExperimentId();
            if (ksExperimentId != null) {
                Experiment experiment = experimentMapper.loadById(ksExperimentId);
                if (experiment != null) {
                    rwdextraPrintInfo.setKstzypbh(experiment.getSampleId());
                    if (experiment.getReportDate() != null) {
                        rwdextra.setPlantime(experiment.getReportDate());
                    }
                    rwdextraPrintInfo.setKstzjl(NullUtils.isQualified(experiment.getIsQualified()));
                    /**试验台账对应试验项目信息*/
                    /*List<ExperimentDetail> experimentDetailList = experimentDetailMapper.selectByExperimentId(ksExperimentId, TestProjectEnum.CONCRETE_PARAM_KSDJ.getCode());
                    if (CollectionUtil.isNotEmpty(experimentDetailList)) {
                        *//**将json转成对象*//*
                        ConcreteKsdj concreteKsdj = experimentDetailList.get(0).getObjJson().toJavaObject(ConcreteKsdj.class);
                        String ssksdj = concreteKsdj.getSsksdj();
                        String ksdj = rwdextra.getRwdextraInfo().getFTbj().split("|")[3];
                        if (ssksdj.compareTo(ksdj) >= 0) {
                            rwdextraPrintInfo.setKstzjl("合格");
                        } else {
                            rwdextraPrintInfo.setKstzjl("不合格");
                        }
                    }*/
                }
            }
            /**抗氯离子台账*/
            Long kllExperimentId = rwdextraPrintInfo.getKllExperimentId();
            if (kllExperimentId != null) {
                Experiment experiment = experimentMapper.loadById(kllExperimentId);
                if (experiment != null) {
                    rwdextraPrintInfo.setKllztzypbh(experiment.getSampleId());
                    /**试验台账对应试验项目信息*/
                    List<ExperimentDetail> experimentDetailList = experimentDetailMapper.selectByExperimentId(kllExperimentId, TestProjectEnum.CONCRETE_PARAM_XNBG_LLZHL.getCode());
                    if (CollectionUtil.isNotEmpty(experimentDetailList)) {
                        /**将json转成对象*/
                        ConcreteXnbgLlzhl concreteXnbgLlzhl = experimentDetailList.get(0).getObjJson().toJavaObject(ConcreteXnbgLlzhl.class);
                        rwdextraPrintInfo.setKllztzjl(concreteXnbgLlzhl.getDxjl());
                        ConcreteXnbgLlzhl.SynInfo synInfo = concreteXnbgLlzhl.getSynInfo();
                        if (synInfo != null) {
                            rwdextraPrintInfo.setLlzhl(synInfo.getLlzhl());
                        }
                    }
                }
            }
            /**抗折台账*/
            Long kzExperimentId = rwdextraPrintInfo.getKzExperimentId();
            if (kzExperimentId != null) {
                Experiment experiment = experimentMapper.loadById(kzExperimentId);
                if (experiment != null) {
                    rwdextraPrintInfo.setKztzypbh(experiment.getSampleId());
                    /**试验台账对应试验项目信息*/
                    List<ExperimentDetail> experimentDetailList = experimentDetailMapper.selectByExperimentId(kllExperimentId, TestProjectEnum.CONCRETE_PARAM_KZQD.getCode());
                    if (CollectionUtil.isNotEmpty(experimentDetailList)) {
                        /**将json转成对象*/
                        ConcreteKzqd concreteKzqd = experimentDetailList.get(0).getObjJson().toJavaObject(ConcreteKzqd.class);
                        rwdextraPrintInfo.setKllztzjl(concreteKzqd.getDxjl());
                    }
                }
            }
        }
    }

    /**
     * 获取配合比验证记录对应的厂家、批号等信息
     * 1.任务单的工程名称 和配合比编号  去查询验证记录有没有
     * 如果没有的话   就取对应配合比同规格、最近的报告日期小于供应日期的  协会那边的报告编号    质保书编号：试验委托中的批次字段
     * <p>
     * 2.任务单的配合和工程 能查询到  但是对应的原材料厂家未设置
     * 就取对应配合比同规格、最近的报告日期小于供应日期的  协会那边的报告编号    质保书编号：试验委托中的批次字段
     * <p>
     * 3.任务单的配合比和工程  能查询到  并且厂家已设置
     * 就取对应配合比同规格、同厂家、最近的报告日期小于供应日期的  协会那边的报告编号    质保书编号：试验委托中的批次字段
     *
     * @param verifyRecord       验证记录
     * @param proportionMaterial 配合比中各种原材料的用量信息
     * @param planTime           任务单计划时间
     * @return
     */
    @Override
    public PrintVerifyRecordOtherInfo getMixProportionVerifyRecordInfo(MixProportionVerifyRecord verifyRecord, JSONObject proportionMaterial, Date planTime) {
        PrintVerifyRecordOtherInfo otherInfo = new PrintVerifyRecordOtherInfo();
        /**对应配合比的原材料信息都没有设置直接返回*/
        if (proportionMaterial.isEmpty()) {
            return otherInfo;
        }
        MixProportionReport mixProportionReport = JsonUtils.getObject(proportionMaterial, MixProportionReport.class);
        if (mixProportionReport == null) {
            return otherInfo;
        }

        if (verifyRecord == null) {
            verifyRecord = new MixProportionVerifyRecord();
        }

        MixProportionReport.BgxxInfo sn = mixProportionReport.getSn();//水泥
        otherInfo.setSnInfo(this.payloadVerifyRecordInfo(verifyRecord.getSnFactory(), verifyRecord.getSnFactoryCalled(), sn, planTime, MaterialsEnum.CEMENT.getCode()));

        MixProportionReport.BgxxInfo fmh = mixProportionReport.getFmh();//粉煤灰
        otherInfo.setFmh1Info(this.payloadVerifyRecordInfo(verifyRecord.getFmh1Factory(), verifyRecord.getFmh1FactoryCalled(), fmh, planTime, MaterialsEnum.FLY.getCode()));
        otherInfo.setFmh2Info(this.payloadVerifyRecordInfo(verifyRecord.getWcl1Factory(), verifyRecord.getWcl1FactoryCalled(), fmh, planTime, MaterialsEnum.FLY.getCode()));

        MixProportionReport.BgxxInfo kzf = mixProportionReport.getKzf();//矿渣粉
        otherInfo.setKzf1Info(this.payloadVerifyRecordInfo(verifyRecord.getKzf1Factory(), verifyRecord.getKzf1FactoryCalled(), kzf, planTime, MaterialsEnum.SLAG.getCode()));
        otherInfo.setKzf2Info(this.payloadVerifyRecordInfo(verifyRecord.getWcl2Factory(), verifyRecord.getWcl2FactoryCalled(), kzf, planTime, MaterialsEnum.SLAG.getCode()));

        MixProportionReport.BgxxInfo cgl = mixProportionReport.getCgl();//粗骨料
        otherInfo.setCglInfo(this.payloadVerifyRecordInfo(verifyRecord.getCglFactory(), verifyRecord.getCglFactoryCalled(), cgl, planTime, MaterialsEnum.COARSE.getCode()));

        MixProportionReport.BgxxInfo xgl = mixProportionReport.getXgl();//细骨料
        otherInfo.setXglInfo(this.payloadVerifyRecordInfo(verifyRecord.getXglFactory(), verifyRecord.getXglFactoryCalled(), xgl, planTime, MaterialsEnum.FINE.getCode()));

        MixProportionReport.BgxxInfo wjj1 = mixProportionReport.getWjj1();//外加剂1
        otherInfo.setWjj1Info(this.payloadVerifyRecordInfo(verifyRecord.getWjj1Factory(), verifyRecord.getWjj1FactoryCalled(), wjj1, planTime, MaterialsEnum.ADMIXTURE.getCode()));

        MixProportionReport.BgxxInfo wjj2 = mixProportionReport.getWjj2();//外加剂2
        otherInfo.setWjj2Info(this.payloadVerifyRecordInfo(verifyRecord.getWjj2Factory(), verifyRecord.getWjj2FactoryCalled(), wjj2, planTime, MaterialsEnum.ADMIXTURE.getCode()));

        return otherInfo;
    }

    /**
     * 1.任务单的工程名称 和配合比编号  去查询验证记录有没有
     * 如果没有的话   就取对应配合比同规格、最近的报告日期小于供应日期的  协会那边的报告编号    质保书编号：试验委托中的批次字段
     * <p>
     * 2.任务单的配合和工程 能查询到  但是对应的原材料厂家未设置
     * 就取对应配合比同规格、最近的报告日期小于供应日期的  协会那边的报告编号    质保书编号：试验委托中的批次字段
     * <p>
     * 3.任务单的配合比和工程  能查询到  并且厂家已设置
     * 就取对应配合比同规格、同厂家、最近的报告日期小于供应日期的  协会那边的报告编号    质保书编号：试验委托中的批次字段
     *
     * @param factory       验证记录的生产厂家
     * @param bgxxInfo      配合比中的原材料信息
     * @param planTime      任务单计划时间
     * @param materialsType 材料类型  1-水泥 2-粉煤灰 3-矿渣粉 4-粗骨料 5-细骨料 6-外加剂 7-混凝土
     * @return
     */
    private PrintVerifyRecordOtherInfo.VerifyRecordInfo payloadVerifyRecordInfo(String factory, String factoryCalled, MixProportionReport.BgxxInfo bgxxInfo, Date planTime, Integer materialsType) {
        PrintVerifyRecordOtherInfo.VerifyRecordInfo recordInfo = new PrintVerifyRecordOtherInfo.VerifyRecordInfo();
        String clmc = bgxxInfo.getClmc();
        String clgg = bgxxInfo.getClgg();

        /**材料名称或规格或类型为空 都是查询不到数据的*/
        if (StringUtils.isBlank(clmc) || StringUtils.isBlank(clgg)) {
            return recordInfo;
        }

        /**当配合比不存在验证记录 得到最近的同材料名称规格的实验台账 小于任务单计划时间(前一天的最近一条) 且物料甲供等于否**/
        if (StringUtils.isBlank(factory)) {
            Experiment experiment = experimentMapper.getLastExperimentInfoNotFactory(clmc, clgg, materialsType, planTime);
            if (experiment != null) {
                recordInfo.setBatch(experiment.getBatch());
                recordInfo.setCertificateNo(experiment.getCertificateNo());
                recordInfo.setReportId(experiment.getReportNo());
                recordInfo.setCj(experiment.getFactory());
                recordInfo.setCjjc(experiment.getFactoryCalled());
                recordInfo.setGys(experiment.getSupplyCompanyName());
                recordInfo.setGysjc(experiment.getSupplyCompanyCalled());
            }
        } else {
            /**当配合比存在验证记录 任务单工程名称配合比验证记录相同  得到指定厂家的原材料报告**/
            recordInfo.setCj(factory);
            recordInfo.setCjjc(factoryCalled);
            Experiment experiment = experimentMapper.getLastExperimentInfo(clmc, clgg, materialsType, factory, planTime);
            if (experiment != null) {
                recordInfo.setBatch(experiment.getBatch());
                recordInfo.setCertificateNo(experiment.getCertificateNo());
                recordInfo.setReportId(experiment.getReportNo());
                recordInfo.setGys(experiment.getSupplyCompanyName());
                recordInfo.setGysjc(experiment.getSupplyCompanyCalled());
            }
        }
        bgxxInfo.setBatch(recordInfo.getBatch());
        bgxxInfo.setXhbgbh(recordInfo.getReportId());
        return recordInfo;
    }

    @Override
    public List<PrintExperimentInfo> getErpRwdPrintInfoToUpdateLog(List<Long> updateLogIdList) {
        List<PrintExperimentInfo> list = new ArrayList<>();
        List<RwdextraUpdateLog> updateLogList = rwdextraUpdateLogMapper.selectUpdateLogIdList(updateLogIdList);
        if (updateLogList.isEmpty()) {
            return list;
        }
        for (RwdextraUpdateLog updateLog : updateLogList) {
            Integer frwd = updateLog.getFrwdh();

            Rwdextra rwdextra = rwdextraService.selectByFrwdh(frwd);
            if (rwdextra == null) {
                log.info("获取打印数据，对应的ERP任务单信息不存在，任务单id：【{}】", frwd);
                continue;
            }

            JSONObject extendAfterJson = updateLog.getRwdextraExtendAfterJson();
            if (extendAfterJson == null || extendAfterJson.isEmpty()) {
                log.info("获取修改记录打印数据失败，修改后任务单扩展记录信息不存在，任务单修改记录id：【{}】，任务单号：【{}】", updateLog.getId(), frwd);
                continue;
            }

            /** 根据前端打印赋值，将RwdextraExtend需要覆盖掉Rwdextra 对象的值做处理**/
            RwdextraExtend rwdextraExtend = JsonUtils.getObject(extendAfterJson, RwdextraExtend.class);
            setRwdextraValue(rwdextraExtend, rwdextra);

            RwdextraExtend afterRwdextraExtend = JsonUtils.getObject(extendAfterJson, RwdextraExtend.class);

            PrintExperimentInfo printInfo = this.payloadPrintExperimentInfo(rwdextra, afterRwdextraExtend);
            list.add(printInfo);
        }
        return list;
    }

    @Override
    public void setRwdextraValue(RwdextraExtend rwdextraExtend, Rwdextra rwdextra) {
        rwdextraExtend.setRwdextraPrintInfo(JsonUtils.getObject(rwdextraExtend.getPrintJson(), RwdextraPrintInfo.class));
        /**如果修改过,需要重新复制到任务单中**/
        /** 计划方量 **/
        if (StringUtils.isNotBlank(rwdextraExtend.getPlanQuantity())) {
            rwdextra.getRwdextraInfo().setFJhsl(rwdextraExtend.getPlanQuantity());
            rwdextra.setPlanquantity(Float.valueOf(rwdextraExtend.getPlanQuantity()));
        }

        /** 施工部位 **/
        if (StringUtils.isNotBlank(rwdextraExtend.getPlanQuantity())) {
            rwdextra.getRwdextraInfo().setFJzbw(rwdextraExtend.getPouringPosition());
        }
        /** 配合比报告编号 **/
        if (StringUtils.isNotBlank(rwdextraExtend.getRwdextraPrintInfo().getPhbbgbh())) {
            rwdextra.getRwdextraInfo().setFRwno(rwdextraExtend.getRwdextraPrintInfo().getPhbbgbh());
        }
        /** 完成方量 **/
        if (StringUtils.isNotBlank(rwdextraExtend.getRwdextraPrintInfo().getFWcsl())) {
            rwdextra.setFhquantity(Float.valueOf(rwdextraExtend.getRwdextraPrintInfo().getFWcsl()));
        }
        RwdextraPrintInfo.Customer customer = rwdextraExtend.getRwdextraPrintInfo().getCustomer();
        if (customer != null) {
            /** 工程名称 **/
            if (StringUtils.isNotBlank(customer.getProjectName())) {
                rwdextra.getRwdextraInfo().setFGcmc(customer.getProjectName());
            }
            /** 施工单位 **/
            if (StringUtils.isNotBlank(customer.getCustomerName())) {
                rwdextra.setBuildNameNew(customer.getCustomerName());
                rwdextra.getRwdextraInfo().setFHtdw(customer.getCustomerName());
            }
            /** 供应数量 **/
            if (StringUtils.isNotBlank(rwdextraExtend.getRwdextraPrintInfo().getFWcsl())) {
                rwdextra.getRwdextraInfo().setFWcsl(rwdextraExtend.getRwdextraPrintInfo().getFWcsl());
            }
            /** 砼品种 **/
            if (StringUtils.isNotBlank(customer.getFtpz())) {
                rwdextra.getRwdextraInfo().setFTpz(customer.getFtpz());
                String ksdjOld = ConvertUtils.getMesTpzToKs(rwdextra.getRwdextraInfo().getFTbj());
                String ksdj = ConvertUtils.getMesTpzToKs(customer.getFtpz());
                rwdextra.getRwdextraInfo().setFTbj(rwdextra.getRwdextraInfo().getFTbj().replace(ksdjOld, ksdj));
            }
            /** 配合比号 **/
            if (StringUtils.isNotBlank(customer.getFPhbNo())) {
                rwdextra.getRwdextraInfo().setFPhbNo(customer.getFPhbNo());
                rwdextra.getRwdextraInfo().setPhbshow(customer.getFPhbNo());
                rwdextra.setPhbshow(customer.getFPhbNo());
            }
            /** 计划日期 **/
            if (StringUtils.isNotBlank(customer.getPlantimeStart())) {
                rwdextra.getRwdextraInfo().setFJhrq(customer.getPlantimeStart());
            }
            /** 塌落度 **/
            if (StringUtils.isNotBlank(customer.getTld())) {
                rwdextra.getRwdextraInfo().setFTld(customer.getTld());
            }
            /** 完成方量 **/
            if (StringUtils.isNotBlank(customer.getFhquantity())) {
                rwdextra.setFhquantity(Float.valueOf(customer.getFhquantity()));
            }
        }
    }

    public PrintMixExperimentInfo getMixMaterialsExperimentInfo(MixProportion mixProportion, Rwdextra rwdextra) {
        JSONObject proportionMaterial = mixProportion.getProportionMaterial();
        if (proportionMaterial == null) {
            return null;
        }
        Date planTime = rwdextra.getPlantime();
        RwdextraInfo rwdextraInfo = rwdextra.getRwdextraInfo();
        String fGcmc = rwdextraInfo.getFGcmc();
        /**这里根据工程名称+配合比唯一标识 查询配合比验证记录 一个配合比同一个工程只能有一条记录*/
        MixProportionVerifyRecord verifyRecord = mixProportionVerifyRecordMapper.selectByMixIdAndProjectName(mixProportion.getId(), fGcmc);
        ErpProject project = erpProjectMapper.selectByName(fGcmc);
        ProjectMaterialsReport projectMaterialsReport = new ProjectMaterialsReport();
        if (project != null && project.getProjectMaterial() != null) {
            projectMaterialsReport = JsonUtils.getObject(project.getProjectMaterial(), ProjectMaterialsReport.class);
        }
        PrintMixExperimentInfo mixExperimentInfo = new PrintMixExperimentInfo();
        MixProportionReport mixProportionReport = JsonUtils.getObject(proportionMaterial, MixProportionReport.class);
        MixProportionReport.BgxxInfo sn = mixProportionReport.getSn();//水泥
        mixExperimentInfo.setSnInfo(this.getPrintTaskExperimentInfo(sn, planTime, verifyRecord == null ? null : verifyRecord.getSnFactory(), projectMaterialsReport == null ? null : projectMaterialsReport.getSn()));

        MixProportionReport.BgxxInfo fmh = mixProportionReport.getFmh();//粉煤灰
        mixExperimentInfo.setFmhInfo(this.getPrintTaskExperimentInfo(fmh, planTime, verifyRecord == null ? null : verifyRecord.getFmh1Factory(), projectMaterialsReport == null ? null : projectMaterialsReport.getFmh()));

        MixProportionReport.BgxxInfo kzf = mixProportionReport.getKzf();//矿渣粉
        mixExperimentInfo.setKzfInfo(this.getPrintTaskExperimentInfo(kzf, planTime, verifyRecord == null ? null : verifyRecord.getKzf1Factory(), projectMaterialsReport == null ? null : projectMaterialsReport.getKzf()));

        MixProportionReport.BgxxInfo cgl = mixProportionReport.getCgl();//粗骨料
        mixExperimentInfo.setCglInfo(this.getPrintTaskExperimentInfo(cgl, planTime, verifyRecord == null ? null : verifyRecord.getCglFactory(), projectMaterialsReport == null ? null : projectMaterialsReport.getCgl()));

        MixProportionReport.BgxxInfo xgl = mixProportionReport.getXgl();//细骨料
        mixExperimentInfo.setXglInfo(this.getPrintTaskExperimentInfo(xgl, planTime, verifyRecord == null ? null : verifyRecord.getXglFactory(), projectMaterialsReport == null ? null : projectMaterialsReport.getXgl()));

        MixProportionReport.BgxxInfo wjj1 = mixProportionReport.getWjj1();//外加剂1
        mixExperimentInfo.setWjj1Info(this.getPrintTaskExperimentInfo(wjj1, planTime, verifyRecord == null ? null : verifyRecord.getWjj1Factory(), projectMaterialsReport == null ? null : projectMaterialsReport.getWjj1()));

        MixProportionReport.BgxxInfo wjj2 = mixProportionReport.getWjj2();//外加剂2
        mixExperimentInfo.setWjj2Info(this.getPrintTaskExperimentInfo(wjj2, planTime, verifyRecord == null ? null : verifyRecord.getWjj2Factory(), projectMaterialsReport == null ? null : projectMaterialsReport.getWjj2()));

        MixProportionReport.BgxxInfo wcl1 = mixProportionReport.getWcl1();//外掺料1
        mixExperimentInfo.setWcl1Info(this.getPrintTaskExperimentInfo(wcl1, planTime, verifyRecord == null ? null : verifyRecord.getWcl1Factory(), projectMaterialsReport == null ? null : projectMaterialsReport.getWcl1()));

        MixProportionReport.BgxxInfo wcl2 = mixProportionReport.getWcl2();//外掺料2
        mixExperimentInfo.setWcl2Info(this.getPrintTaskExperimentInfo(wcl2, planTime, verifyRecord == null ? null : verifyRecord.getWcl2Factory(), projectMaterialsReport == null ? null : projectMaterialsReport.getWcl2()));
        mixProportion.setProportionMaterial(JsonUtils.beanToObject(mixProportionReport));
        return mixExperimentInfo;
    }

    /**
     * 任务单的配比，去拿到对应材料类型，材料名称，材料规格，去获取最近已完成的一份试验
     *
     * @param mixProportion 配合比原材料信息
     * @param planTime      任务单计划时间
     * @return
     */
    @Override
    public PrintMixExperimentInfo getMixMaterialsExperimentInfo(MixProportion mixProportion, Date planTime) {
        JSONObject proportionMaterial = mixProportion.getProportionMaterial();
        if (proportionMaterial == null) {
            return null;
        }
        PrintMixExperimentInfo mixExperimentInfo = new PrintMixExperimentInfo();
        MixProportionReport mixProportionReport = JsonUtils.getObject(proportionMaterial, MixProportionReport.class);
        MixProportionReport.BgxxInfo sn = mixProportionReport.getSn();//水泥
        mixExperimentInfo.setSnInfo(this.getPrintTaskExperimentInfo(sn, planTime));

        MixProportionReport.BgxxInfo fmh = mixProportionReport.getFmh();//粉煤灰
        mixExperimentInfo.setFmhInfo(this.getPrintTaskExperimentInfo(fmh, planTime));

        MixProportionReport.BgxxInfo kzf = mixProportionReport.getKzf();//矿渣粉
        mixExperimentInfo.setKzfInfo(this.getPrintTaskExperimentInfo(kzf, planTime));

        MixProportionReport.BgxxInfo cgl = mixProportionReport.getCgl();//粗骨料
        mixExperimentInfo.setCglInfo(this.getPrintTaskExperimentInfo(cgl, planTime));

        MixProportionReport.BgxxInfo xgl = mixProportionReport.getXgl();//细骨料
        mixExperimentInfo.setXglInfo(this.getPrintTaskExperimentInfo(xgl, planTime));

        MixProportionReport.BgxxInfo wjj1 = mixProportionReport.getWjj1();//外加剂1
        mixExperimentInfo.setWjj1Info(this.getPrintTaskExperimentInfo(wjj1, planTime));

        MixProportionReport.BgxxInfo wjj2 = mixProportionReport.getWjj2();//外加剂2
        mixExperimentInfo.setWjj2Info(this.getPrintTaskExperimentInfo(wjj2, planTime));

        MixProportionReport.BgxxInfo wcl1 = mixProportionReport.getWcl1();//外掺料1
        mixExperimentInfo.setWcl1Info(this.getPrintTaskExperimentInfo(wcl1, planTime));

        MixProportionReport.BgxxInfo wcl2 = mixProportionReport.getWcl2();//外掺料2
        mixExperimentInfo.setWcl2Info(this.getPrintTaskExperimentInfo(wcl2, planTime));
        mixProportion.setProportionMaterial(JsonUtils.beanToObject(mixProportionReport));
        return mixExperimentInfo;
    }


    /**
     * 配合比对应绑定的试验委托,并更新配合比对应委托信息
     *
     * @param mixProportion
     * @return
     */
    private PrintMixExperimentInfo getMixExperimentInfoUpdatePhb(MixProportion mixProportion) {
        JSONObject proportionMaterial = mixProportion.getProportionMaterial();
        if (proportionMaterial == null) {
            return null;
        }
        PrintMixExperimentInfo mixExperimentInfo = new PrintMixExperimentInfo();
        MixProportionReport mixProportionReport = JsonUtils.getObject(proportionMaterial, MixProportionReport.class);
        MixProportionReport.BgxxInfo sn = mixProportionReport.getSn();//水泥
        mixExperimentInfo.setSnInfo(this.getPrintTaskExperimentInfoUpdatePhb(sn));

        MixProportionReport.BgxxInfo fmh = mixProportionReport.getFmh();//粉煤灰
        mixExperimentInfo.setFmhInfo(this.getPrintTaskExperimentInfoUpdatePhb(fmh));

        MixProportionReport.BgxxInfo kzf = mixProportionReport.getKzf();//矿渣粉
        mixExperimentInfo.setKzfInfo(this.getPrintTaskExperimentInfoUpdatePhb(kzf));

        MixProportionReport.BgxxInfo cgl = mixProportionReport.getCgl();//粗骨料
        mixExperimentInfo.setCglInfo(this.getPrintTaskExperimentInfoUpdatePhb(cgl));

        MixProportionReport.BgxxInfo xgl = mixProportionReport.getXgl();//细骨料
        mixExperimentInfo.setXglInfo(this.getPrintTaskExperimentInfoUpdatePhb(xgl));

        MixProportionReport.BgxxInfo wjj1 = mixProportionReport.getWjj1();//外加剂1
        mixExperimentInfo.setWjj1Info(this.getPrintTaskExperimentInfoUpdatePhb(wjj1));

        MixProportionReport.BgxxInfo wjj2 = mixProportionReport.getWjj2();//外加剂2
        mixExperimentInfo.setWjj2Info(this.getPrintTaskExperimentInfoUpdatePhb(wjj2));

        MixProportionReport.BgxxInfo wcl1 = mixProportionReport.getWcl1();//外掺料1
        mixExperimentInfo.setWcl1Info(this.getPrintTaskExperimentInfoUpdatePhb(wcl1));

        MixProportionReport.BgxxInfo wcl2 = mixProportionReport.getWcl2();//外掺料2
        mixExperimentInfo.setWcl2Info(this.getPrintTaskExperimentInfoUpdatePhb(wcl2));
        mixProportion.setProportionMaterial(JsonUtils.beanToObject(mixProportionReport));
        return mixExperimentInfo;
    }

    /**
     * 组装打印的printJson
     *
     * @param extendMaterials       任务单信息
     * @param mixProportionReport 任务单扩展信息
     */
    private void setRwdextraExtendMaterials(RwdextraExtendMaterials extendMaterials, MixProportionReport mixProportionReport) {
        RwdextraExtendMaterialsInfo sn = extendMaterials.getSnInfo();//水泥
        mixProportionReport.setSn(this.setPrintTaskExperimentInfo(sn,mixProportionReport.getSn()));

        RwdextraExtendMaterialsInfo fmh = extendMaterials.getFmhInfo();//粉煤灰
        mixProportionReport.setFmh(this.setPrintTaskExperimentInfo(fmh,mixProportionReport.getFmh()));

        RwdextraExtendMaterialsInfo kzf = extendMaterials.getKzfInfo();//矿渣粉
        mixProportionReport.setKzf(this.setPrintTaskExperimentInfo(kzf,mixProportionReport.getKzf()));

        RwdextraExtendMaterialsInfo cgl = extendMaterials.getCglInfo();//粗骨料
        mixProportionReport.setCgl(this.setPrintTaskExperimentInfo(cgl,mixProportionReport.getCgl()));

        RwdextraExtendMaterialsInfo xgl = extendMaterials.getXglInfo();//细骨料
        mixProportionReport.setXgl(this.setPrintTaskExperimentInfo(xgl,mixProportionReport.getXgl()));

        RwdextraExtendMaterialsInfo wjj = extendMaterials.getWjjInfo();//外加剂1
        mixProportionReport.setWjj1(this.setPrintTaskExperimentInfo(wjj,mixProportionReport.getWjj1()));
    }

    public MixProportionReport.BgxxInfo setPrintTaskExperimentInfo(RwdextraExtendMaterialsInfo materialsInfo,MixProportionReport.BgxxInfo bgxxInfo){
        if (materialsInfo == null) {
            return bgxxInfo;
        }
        if(StringUtils.isNotBlank(materialsInfo.getFactory())){
            bgxxInfo.setCj(StringHelperUtils.removeBrackets(materialsInfo.getFactory()));
        }else{
            bgxxInfo.setCj("");
        }
        if(StringUtils.isNotBlank(materialsInfo.getFactoryCalled())){
            bgxxInfo.setCjjc(materialsInfo.getFactoryCalled());
        }else{
            bgxxInfo.setCjjc("");
        }
        if(StringUtils.isNotBlank(materialsInfo.getSupplyCompanyName())){
            bgxxInfo.setGys(StringHelperUtils.removeBrackets(materialsInfo.getSupplyCompanyName()));
        }else{
            bgxxInfo.setGys("");
        }
        if(StringUtils.isNotBlank(materialsInfo.getSupplyCompanyCalled())){
            bgxxInfo.setGysjc(materialsInfo.getSupplyCompanyCalled());
        }else{
            bgxxInfo.setGysjc("");
        }
        if(StringUtils.isNotBlank(materialsInfo.getWarrantyNo())) {
            bgxxInfo.setBatch(materialsInfo.getWarrantyNo());
        }else{
            bgxxInfo.setBatch("");
        }
        if(StringUtils.isNotBlank(materialsInfo.getReportNo())) {
            bgxxInfo.setXhbgbh(materialsInfo.getReportNo());
        }else{
            bgxxInfo.setXhbgbh("");
        }
        if(StringUtils.isNotBlank(materialsInfo.getMaterialName())){
            String mc = StringHelperUtils.removeBrackets(materialsInfo.getMaterialName());
            bgxxInfo.setClmc(mc);
            bgxxInfo.setWlmc(mc);
        }else{
            bgxxInfo.setClmc("");
            bgxxInfo.setWlmc("");
        }
        if(StringUtils.isNotBlank(materialsInfo.getMaterialSpec())){
            bgxxInfo.setClgg(materialsInfo.getMaterialAbbreviation()+materialsInfo.getMaterialSpec());
            bgxxInfo.setWlgg(materialsInfo.getMaterialAbbreviation()+materialsInfo.getMaterialSpec());
        }else{
            bgxxInfo.setClgg("");
            bgxxInfo.setWlgg("");
        }
        return bgxxInfo;
    }
    /**
     * 配合比对应绑定的试验委托
     *
     * @param mixProportion
     * @return
     */
    @Override
    public PrintMixExperimentInfo getMixExperimentInfo(MixProportion mixProportion) {
        JSONObject proportionMaterial = mixProportion.getProportionMaterial();
        if (proportionMaterial == null) {
            return null;
        }
        PrintMixExperimentInfo mixExperimentInfo = new PrintMixExperimentInfo();
        MixProportionReport mixProportionReport = JsonUtils.getObject(proportionMaterial, MixProportionReport.class);
        MixProportionReport.BgxxInfo sn = mixProportionReport.getSn();//水泥
        mixExperimentInfo.setSnInfo(this.getPrintTaskExperimentInfo(sn.getPktzid()));

        MixProportionReport.BgxxInfo fmh = mixProportionReport.getFmh();//粉煤灰
        mixExperimentInfo.setFmhInfo(this.getPrintTaskExperimentInfo(fmh.getPktzid()));

        MixProportionReport.BgxxInfo kzf = mixProportionReport.getKzf();//矿渣粉
        mixExperimentInfo.setKzfInfo(this.getPrintTaskExperimentInfo(kzf.getPktzid()));

        MixProportionReport.BgxxInfo cgl = mixProportionReport.getCgl();//粗骨料
        mixExperimentInfo.setCglInfo(this.getPrintTaskExperimentInfo(cgl.getPktzid()));

        MixProportionReport.BgxxInfo xgl = mixProportionReport.getXgl();//细骨料
        mixExperimentInfo.setXglInfo(this.getPrintTaskExperimentInfo(xgl.getPktzid()));

        MixProportionReport.BgxxInfo wjj1 = mixProportionReport.getWjj1();//外加剂1
        mixExperimentInfo.setWjj1Info(this.getPrintTaskExperimentInfo(wjj1.getPktzid()));

        MixProportionReport.BgxxInfo wjj2 = mixProportionReport.getWjj2();//外加剂2
        mixExperimentInfo.setWjj2Info(this.getPrintTaskExperimentInfo(wjj2.getPktzid()));

        MixProportionReport.BgxxInfo wcl1 = mixProportionReport.getWcl1();//外掺料1
        mixExperimentInfo.setWcl1Info(this.getPrintTaskExperimentInfo(wcl1.getPktzid()));

        MixProportionReport.BgxxInfo wcl2 = mixProportionReport.getWcl2();//外掺料2
        mixExperimentInfo.setWcl2Info(this.getPrintTaskExperimentInfo(wcl2.getPktzid()));
        return mixExperimentInfo;
    }

    /**
     * 根据配合中 材料名称+材料规格+材料类型 获取任务单的计划时间之前最近的一条
     *
     * @param bgxxInfo 配合比原材料信息
     * @param planTime 任务单号
     * @return
     */
    private PrintTaskExperimentInfo getPrintTaskExperimentInfo(MixProportionReport.BgxxInfo bgxxInfo, Date planTime, String factory, ProjectMaterialsReport.MaterialsInfo materialsInfo) {
        String clmc = bgxxInfo.getClmc();//材料名称
        String clgg = bgxxInfo.getClgg();//材料规格
        String cllx = bgxxInfo.getCllx();//材料类型
        if (StringUtils.isBlank(clmc) || StringUtils.isBlank(clgg) || StringUtils.isBlank(cllx)) {
            return null;
        }
        ExperimentPrintVo experimentPrintVo = new ExperimentPrintVo().setCllx(cllx).setClmc(clmc).setClgg(clgg).setPlanTime(planTime);
        Experiment experiment = null;
        if (StringUtils.isNotBlank(factory)) {
            /**当配合比存在验证记录 任务单工程名称配合比验证记录相同  得到指定厂家的原材料报告**/
            experimentPrintVo.setFactory(factory);
            experiment = experimentMapper.getLastExperimentIdNotSelfSupply(experimentPrintVo);
        } else if (materialsInfo != null && StringUtils.isNotBlank(materialsInfo.getCllx())) {
            experimentPrintVo.setMaterialsValue(experimentPrintVo, materialsInfo);
            /**当对应工程有绑定物料,根据物料  得到指定厂家的原材料报告**/
            experiment = experimentMapper.getLastExperimentIdNotSelfSupply(experimentPrintVo);
        } else {
            /**获取条件为非甲供  得到指定厂家的原材料报告**/
            experimentPrintVo.setSelfSupply(SelfSupplyEnum.YES.getCode());
            experiment = experimentMapper.getLastExperimentIdNotSelfSupply(experimentPrintVo);

        }
        PrintTaskExperimentInfo printTaskExperimentInfo = this.getPrintTaskExperimentInfo(experiment.getId());
        if (experiment != null) {
            Experiment experimentInfo = printTaskExperimentInfo.getExperimentInfo();
            bgxxInfo.setBatch(experimentInfo.getBatch());
            bgxxInfo.setXhbgbh(experimentInfo.getReportNo());
            bgxxInfo.setGys(experimentInfo.getSupplyCompanyName());
            bgxxInfo.setGysjc(experimentInfo.getSupplyCompanyCalled());
            bgxxInfo.setCj(experimentInfo.getFactory());
            bgxxInfo.setCjjc(experimentInfo.getFactoryCalled());
        }
        return printTaskExperimentInfo;
    }

    /**
     * 根据配合中 材料名称+材料规格+材料类型 获取任务单的计划时间之前最近的一条
     *
     * @param bgxxInfo 配合比原材料信息
     * @param planTime 任务单号
     * @return
     */
    private PrintTaskExperimentInfo getPrintTaskExperimentInfo(MixProportionReport.BgxxInfo bgxxInfo, Date planTime) {
        String clmc = bgxxInfo.getClmc();//材料名称
        String clgg = bgxxInfo.getClgg();//材料规格
        String cllx = bgxxInfo.getCllx();//材料类型
        if (StringUtils.isBlank(clmc) || StringUtils.isBlank(clgg) || StringUtils.isBlank(cllx)) {
            return null;
        }
        Long experimentId = experimentMapper.getLastExperimentId(clmc, clgg, cllx, planTime);
        if (experimentId == null) {
            return null;
        }
        return this.getPrintTaskExperimentInfo(experimentId);
    }

    /**
     * 获取对应试验台账所有的信息
     *
     * @param bgxxInfo 配合比原材料信息
     * @return
     */
    private PrintTaskExperimentInfo getPrintTaskExperimentInfoUpdatePhb(MixProportionReport.BgxxInfo bgxxInfo) {
        String objId = bgxxInfo.getPktzid();
        if (objId == null || "".equals(objId) || "null".equals(objId)) {
            return null;
        }
        Long experimentId = Long.valueOf(objId);
        PrintTaskExperimentInfo experimentInfo = new PrintTaskExperimentInfo();
        /**试验台账信息*/
        Experiment experiment = experimentMapper.loadById(experimentId);
        if (experiment == null) {
            log.info("任务单中获取打印数据，对应的试验台账信息不存在，试验台账id：【{}】", experimentId);
            return null;
        }
        experimentInfo.setExperimentId(experimentId);


        /**试验台账对应试验项目信息*/
        List<ExperimentDetail> experimentDetailList = experimentDetailMapper.selectByExperimentId(experimentId, null);
        experimentInfo.setExperimentDetailList(experimentDetailList);
        JSONArray objArray = new JSONArray();
        for (ExperimentDetail experimentDetail : experimentDetailList) {
            objArray.add(experimentDetail.getObjJson());
        }
        experiment.setJcrq(ExperimentDetail.extractDates(objArray));
        experimentInfo.setExperimentInfo(experiment);
        /**试验台账抽样信息*/
        List<ExperimentSampleSmoke> experimentSampleSmokeList = experimentSampleSmokeMapper.selectByExperimentId(experimentId);
        experimentInfo.setExperimentSampleSmokeList(experimentSampleSmokeList);
        /**取样信息*/
        ExperimentSampleTake experimentSampleTake = experimentSampleTakeMapper.selectByExperimentId(experimentId);
        experimentInfo.setExperimentSampleTakeInfo(experimentSampleTake);

        /**上海协会相关数据*/
        List<ShxhSynchronizedata> shxhSynchronizedataList = shxhSynchronizedataMapper.selectByExperimentId(experimentId);
        experimentInfo.setShxhSynchronizedataList(shxhSynchronizedataList);

        /**更新配合比对应信息*/
        bgxxInfo.setBatch(experiment.getBatch());
        bgxxInfo.setXhbgbh(experiment.getReportNo());
        bgxxInfo.setGys(experiment.getSupplyCompanyName());
        bgxxInfo.setGysjc(experiment.getSupplyCompanyCalled());
        bgxxInfo.setCj(experiment.getFactory());
        bgxxInfo.setCjjc(experiment.getFactoryCalled());
        return experimentInfo;
    }

    /**
     * 获取对应试验台账所有的信息
     *
     * @param objId 试验台账id
     * @return
     */
    private PrintTaskExperimentInfo getPrintTaskExperimentInfo(Object objId) {
        if (objId == null || "".equals(objId)) {
            return null;
        }
        Long experimentId = Long.valueOf(objId.toString());
        PrintTaskExperimentInfo experimentInfo = new PrintTaskExperimentInfo();
        /**试验台账信息*/
        Experiment experiment = experimentMapper.loadById(experimentId);
        if (experiment == null) {
            log.info("任务单中获取打印数据，对应的试验台账信息不存在，试验台账id：【{}】", experimentId);
            return null;
        }
        experimentInfo.setExperimentId(experimentId);

        /**试验台账对应试验项目信息*/
        List<ExperimentDetail> experimentDetailList = experimentDetailMapper.selectByExperimentId(experimentId, null);
        experimentInfo.setExperimentDetailList(experimentDetailList);

        JSONArray objArray = new JSONArray();
        for (ExperimentDetail experimentDetail : experimentDetailList) {
            objArray.add(experimentDetail.getObjJson());
        }
        experiment.setJcrq(ExperimentDetail.extractDates(objArray));
        experimentInfo.setExperimentInfo(experiment);

        /**试验台账抽样信息*/
        List<ExperimentSampleSmoke> experimentSampleSmokeList = experimentSampleSmokeMapper.selectByExperimentId(experimentId);
        experimentInfo.setExperimentSampleSmokeList(experimentSampleSmokeList);
        /**取样信息*/
        ExperimentSampleTake experimentSampleTake = experimentSampleTakeMapper.selectByExperimentId(experimentId);
        experimentInfo.setExperimentSampleTakeInfo(experimentSampleTake);

        /**上海协会相关数据*/
        List<ShxhSynchronizedata> shxhSynchronizedataList = shxhSynchronizedataMapper.selectByExperimentId(experimentId);
        experimentInfo.setShxhSynchronizedataList(shxhSynchronizedataList);
        return experimentInfo;
    }

    @Override
    public List<Equipment> getEquipmentPrintInfo(Equipment entity) {
        return equipmentService.getAll(entity);
    }

    @Override
    public List<PrintMixInfoDto> getPrintInfoByMixIds(List<Long> mixIdList) {
        List<PrintMixInfoDto> mixInfoDtoList = new ArrayList<>();
        /**所有配合比信息*/
        List<MixProportion> mixProportionList = mixProportionMapper.getList(new MixProportion().setIds(mixIdList));

        /**查询所有配合比对应任务单信息*/
        Set<String> phbNoList = new HashSet<>();
        for (MixProportion mixProportion : mixProportionList) {
            if (StringUtils.isBlank(mixProportion.getProportionPhb())) {
                continue;
            }
            phbNoList.add(mixProportion.getProportionPhb());
        }
        /**根据配合比号查询所有的任务单*/
        // TODO: 2024/10/30 这里待定 通过配合比号去查询任务单数据量过于多
        //List<Rwdextra> rwdextraList = rwdextraService.selectByPhbNoList(phbNoList);

        for (MixProportion mixProportion : mixProportionList) {
            PrintMixInfoDto mixInfoDto = new PrintMixInfoDto();
            mixInfoDto.setMixId(mixProportion.getId());
            mixInfoDto.setMixCode(mixProportion.getProportionPhb());
            mixInfoDto.setMixProportion(mixProportion);

            /**这里根据工程名称+配合比唯一标识 查询配合比验证记录 一个配合比同一个工程只能有一条记录*/
            //MixProportionVerifyRecord verifyRecord = mixProportionVerifyRecordMapper.selectByMixIdAndProjectName(mixProportion.getId(), fGcmc);
            //PrintVerifyRecordOtherInfo printVerifyRecordOtherInfo = this.getMixProportionVerifyRecordInfo(verifyRecord, mixProportion.getProportionMaterial(), rwdextra.getPlantime());
            //mixInfoDto.setPrintVerifyRecordOtherInfo(printVerifyRecordOtherInfo);

            mixInfoDto.setPrintVerifyRecordOtherInfo(null);
            mixInfoDto.setShxhSynchronizedataList(null);
            mixInfoDto.setRwdextraList(null);
            mixInfoDto.setCompanyName(CompanyConfigInterceptor.getCompanyConfig(1).getCompanyName());
            mixInfoDtoList.add(mixInfoDto);
        }
        return mixInfoDtoList;
    }
}
